import 'package:flutter/material.dart';

//第一种写法
// void main() {
//   runApp(MyApp());
// }

//箭头函数的另一种写法
void main() => runApp(MyApp());

//自定义组件
class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    // MaterialApp是根组件
    return MaterialApp(
      home: Scaffold(
        appBar: AppBar(
          title: Text('text'),
        ),
        body: HomeContent(),
      ),
      theme: ThemeData(primaryColor: Colors.blue),
    );
  }
}

//自定义内容组件
class HomeContent extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    //把container当成div?
    return Container(
      color: Colors.blueGrey,
      child: Text(
        "here is text!here is text!here is text!here is text!here is text!here is text!here is text!here is text!here is text!here is text!",
        textAlign: TextAlign.center,
        style: TextStyle(
            fontSize: 18.0,
            color: Colors.red,
            fontWeight: FontWeight.w800,
            fontStyle: FontStyle.italic,
            decoration: TextDecoration.underline,
            decorationColor: Colors.white,
            decorationStyle: TextDecorationStyle.dashed,
            letterSpacing: 5.0),
        overflow: TextOverflow.ellipsis,
        maxLines: 1, //最大显示行数
        textScaleFactor: 2,
      ),
    );
  }
}
